﻿using System;
using System.Collections.Generic;
using DataLayer.Entities;
using DataLayer.Implementations;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DmsfTestProject
{
    [TestClass]
    public class DonutPrefTest
    {
        [TestMethod]
        public void TestSavePreferences()
        {
            List<DonutPreference> prefs = GetList();
            DonutPrefApplication app = new DonutPrefApplication();
            IList<DonutPreference> prefsDb = app.GetByUserId(1);
            app.Delete((List<DonutPreference>)prefsDb);

            app.Save(prefs);

            Assert.IsFalse(false);
        }

        private List<DonutPreference> GetList()
        {
            List<DonutPreference> prefs = new List<DonutPreference>();
            prefs.Add(new DonutPreference()
            {
                Donut = new Donut()
                {
                    DonutId = 1
                },
                User = new User()
                {
                    UserId = 1
                },
                OrderNumber = 1
            });
            prefs.Add(new DonutPreference()
            {
                Donut = new Donut()
                {
                    DonutId = 3
                },
                User = new User()
                {
                    UserId = 1
                },
                OrderNumber = 3
            });
            prefs.Add(new DonutPreference()
            {
                Donut = new Donut()
                {
                    DonutId = 2
                },
                User = new User()
                {
                    UserId = 1
                },
                OrderNumber = 2
            });
            return prefs;
        }
    }
}
